package com.ebs.md.fxmonitor.marketmonitor.config;

/**
 * Perforce Revision:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/marketmonitor/config/ERegionTimeZone.java $
 *  $Revision: #2 $  $Change: 116351 $  $DateTime: 2012/10/29 16:42:47 $  $Author: Arik.Sher $
 */

import java.util.TimeZone;

public enum ERegionTimeZone
{ 
	  NewYork("NY", "America/New_York")
	, London ("LN", "Europe/London")
	, Tokyo  ("TY", "Asia/Tokyo")
	;
	
	private final String   tzName;
	private final TimeZone timeZone;
	private final String regionName;
	
	ERegionTimeZone(String regionName, String tzName) {
		this.tzName = tzName;
		this.timeZone = TimeZone.getTimeZone(tzName);
		this.regionName = regionName; 
	}

	public String getRegionName() {
		return regionName;
	}

	public String getTzName() {
		return tzName;
	}

	/**
	 * currently private, so will not use it by mistake.
	 * instead, simply use GMT0, same as all other systems 
	 */
	private TimeZone getTimeZone() {
		return timeZone;
	}

	public static ERegionTimeZone getByName(String eRegionName)
	{
		ERegionTimeZone res = null;
		for ( ERegionTimeZone curr: ERegionTimeZone.values() ) {
			if ( curr.getRegionName().equalsIgnoreCase(eRegionName) ) {
				res = curr;
			}
		}
		
		return res;
	}
}
